const path = require("path");
module.exports = {
  externals: {
    // global app config object
    config: JSON.stringify({
      apiUrl: "http://localhost"
    })
  },
  module: {
    rules: [
      { test: /\.xml$/, loader: "xml-loader" },
      {
        test: /\.stories\.jsx?$/,
        loaders: [require.resolve("@storybook/addon-storysource/loader")],
        enforce: "pre"
      },
      // 加载静态文件
      {
        test: /\.(png|jpg|gif)$/,
        use: [
          {
            loader: "file-loader",
            options: {}
          }
        ]
      }
    ]
  },
  resolve: {
    extensions: [".js", ".vue", ".css", ".json"],
    alias: {
      package: path.resolve(__dirname, "../../package.json"),
      semantic: path.resolve(__dirname, "../../semantic"),
      mixins: path.resolve(__dirname, "../../src/mixins"),
      services: path.resolve(__dirname, "../../src/services"),
      assets: path.resolve(__dirname, "../../src/assets"),
      views: path.resolve(__dirname, "../../src/views")
      // 'semantic-calendar': path.resolve(__dirname, './node_modules/semantic-ui-calendar/dist/calendar.js'),
      // 'semantic-calendar-css': path.resolve(__dirname, './node_modules/semantic-ui-calendar/dist/calendar.css')
    }
  }
};
